from django.db import models


# Create your models here.

class OperatorLogModel(models.Model):
    """客户端操作记录模型类"""
    ip_addr = models.CharField('客户端IP地址', max_length=65)
    method = models.CharField('客户端的请求方法', max_length=10)
    user_name = models.CharField('操作的用户', max_length=65)
    operate_time = models.DateTimeField('请求操作的时间', auto_now_add=True)
    path = models.CharField('访问路径', max_length=128)
    duration = models.IntegerField('访问视图函数的耗时，单位毫秒', default=0)
    response_type = models.CharField('响应类别', max_length=65,null=True)
    status = models.IntegerField('响应状态码', default=200)
    is_success = models.BooleanField('操作是否成功', default=False)

    class Meta:
        db_table = 't_operator_log'
        verbose_name = '客户端操作记录表'
        verbose_name_plural = verbose_name
        ordering = ['id']

    def __str__(self):
        pass
